<?php
/**
 * 周舟 hzboye010@163.com
 * addby sublime snippets
 * RedEnvelop Test 红包测试类
 */

namespace app\test\controller;

use app\utils\BoyeService;
use app\test\controller\Ava;

class RedEnvelope extends Ava{

    // 红包不分页查询
    public function query(){
        if(IS_AJAX){
            $data = [
                'uid'        =>I('post.uid',''),
                'is_use'     =>I('post.is_use',''),
                'is_expire'  =>I('post.is_expire',''),
                'api_ver'    =>$this->api_ver,
                'notify_id'  =>$this->notify_id,
                'alg'        =>$this->alg,
                'type'       =>'BY_RedEnvelope_query',
            ];

            $service = new BoyeService();
            $result= $service->callRemote("",$data,true);
            echo $this->parseResult($result);
        }else{
            $this->assign('type','BY_RedEnvelope_query');
            $this->assign('field',[
                ['api_ver','100',LL('need-mark api version')],
                ['uid',25,LL('need-mark user ID')],
                ['is_use','',LL('redEnvelope-use-status')],
                ['is_expire','',LL('redEnvelope-expire-status')],
            ]);
            echo $this->display('ava/test');
        }
    }

    public function __construct(){
        parent::__construct();
    }
}